package com.project.service.impl;

import com.project.bean.ManBean;
import com.project.mapper.IManMapper;
import com.project.service.IManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ManServiceImpl implements IManService {
    @Autowired
    private IManMapper mapper;
    @Override
    public void add(ManBean man) {
        mapper.insert(man);
    }

    @Override
    public void del(Integer id) {
        mapper.deleteById(id);
    }

    @Override
    public void update(Integer id, String phone) {
        ManBean man = mapper.selectById(id);
        man.setPhone(phone);
        mapper.updateById(man);
    }

    @Override
    public ManBean findById(Integer id) {
        return mapper.selectById(id);
    }

    @Override
    public List<ManBean> findAll() {
        return mapper.selectList(null);
    }
}
